const pluginName = 'CopyrightWebpackPlugin'

class CopyrightWebpackPlugin {

	apply(compiler) {

		compiler.hooks.compile.tap(pluginName, (compilation) => {
			console.log('compiler');
		})

		compiler.hooks.emit.tapAsync(pluginName, (compilation, cb) => {
			debugger;
			const text = 'copyright by dell lee'
			compilation.assets['copyright.txt']= {
				source: function() {
					return text
				},
				size: function() {
					return text.length;
				}
			};
			cb();
		})
	}

}

module.exports = CopyrightWebpackPlugin;
